﻿using System;
using System.Collections.Generic;
using System.Text;

namespace daSemanticAnalyser.SemanticTree
{
    using daSyntaxAnalyser.SyntaxTree;

    /// <summary>
    /// Элемент, содержащий секции
    /// </summary>
    public class SectionedSemanticElement : SemanticTreeElement, ISectionedSemanticElement
    {
        private List<ConstSemanticElement> consts;
        private List<ResourceStringSemanticElement> resourcestrings;
        private List<CommonTypeSemanticElement> types;
        private List<VarSemanticElement> vars;
        private List<ThreadvarSemanticElement> threadvars;
        private List<MethodSemanticElement> methods;

        /// <summary>
        /// Константы
        /// </summary>
        public List<ConstSemanticElement> Consts { get { return consts; } set { consts = value; } }

        /// <summary>
        /// Строковые ресурсы
        /// </summary>
        public List<ResourceStringSemanticElement> Resourcestrings { get { return resourcestrings; } set { resourcestrings = value; } }

        /// <summary>
        /// Типы
        /// </summary>
        public List<CommonTypeSemanticElement> Types { get { return types; } set { types = value; } }

        /// <summary>
        /// Переменные
        /// </summary>
        public List<VarSemanticElement> Vars { get { return vars; } set { vars = value; } }

        /// <summary>
        /// Потоковые переменные
        /// </summary>
        public List<ThreadvarSemanticElement> Threadvars { get { return threadvars; } set { threadvars = value; } }

        /// <summary>
        /// Методы
        /// </summary>
        public List<MethodSemanticElement> Methods { get { return methods; } set { methods = value; } }

        /// <summary>
        /// Конструктор
        /// </summary>
        /// <param name="Parent">родительский элемент</param>
        /// <param name="Consts">константы</param>
        /// <param name="Resourcestrings">строковые ресурсы</param>
        /// <param name="Types">типы</param>
        /// <param name="Vars">переменные</param>
        /// <param name="Threadvars">потоковые переменные</param>
        /// <param name="Methods">методы</param>
        /// <param name="SyntaxElement">соответствующий элемент синтаксического дерева</param>
        public SectionedSemanticElement(IChildSemanticElement Parent, List<ConstSemanticElement> Consts, List<ResourceStringSemanticElement> Resourcestrings, List<CommonTypeSemanticElement> Types, List<VarSemanticElement> Vars, List<ThreadvarSemanticElement> Threadvars, List<MethodSemanticElement> Methods, ISyntaxTreeElement SyntaxElement)
            : base(Parent, SyntaxElement)
        {
            consts = (Consts == null) ? new List<ConstSemanticElement>() : Consts;
            resourcestrings = (Resourcestrings == null) ? new List<ResourceStringSemanticElement>() : Resourcestrings;
            types = (Types == null) ? new List<CommonTypeSemanticElement>() : Types;
            vars = (Vars == null) ? new List<VarSemanticElement>() : Vars;
            threadvars = (Threadvars == null) ? new List<ThreadvarSemanticElement>() : Threadvars;
            methods = (Methods == null) ? new List<MethodSemanticElement>() : Methods;
        }
    }
}
